/**
 * Created by Dalyn on 2017/3/23.
 */

import React , {Component}from 'react';

export default class SettlementCenter_item extends React.Component{
    constructor(props){
        super(props);
        this.state={
            // flag:false
        };
        // this.partyBEnid=''
    }

    componentWillMount(){
        // this.partyBEnid = this.props.item.partyBEnid
    }
    /*数字千分制*/
    doubleFormat(obj){
        if(!obj){
            return obj;
        }else{
            return parseFloat(obj).toLocaleString();
        }
    }
    /*日期格式化*/
    dateFormat(time) {
        if(!time){
            return "-";
        }
        let zero = (n) => {
            return n = n > 0 && n < 10 ? "0" + n : n;
        };
        let y = new Date(time).getFullYear();
        let m = new Date(time).getMonth()+1;
        let d = new Date(time).getDate();
        // let h = new Date(time).getHours();
        // let ms = new Date(time).getMinutes();

        // return zero(y)+"-"+zero(m)+"-"+zero(d)+" "+zero(h)+":"+zero(ms);
        return zero(y) + "-" + zero(m) + "-" + zero(d);
    }
    /*操作文字显示*/
    statusText(status){
        if(status == "2"){
            return "审核"
        }else if(status == "3"){
            return "打款"
        }else if(status == "4" || status == "5"){
            return "查看"
        }
    }
    /*点击操作*/
    bombBox(index,item){
        this.props._bombBox(index,item)
    }
    render(){
        return(
            <tr className="settle_rec_tb">
                <td title={this.props.item.orderId}>{this.props.item.orderId}</td>
                <td title={this.props.item.partyBEnName}>{this.props.item.partyBEnName}</td>
                <td>{this.doubleFormat(this.props.item.remainAmount)}</td>
                <td>{this.doubleFormat(this.props.item.loanMoney)}</td>
                <td>{this.props.item.loanInterest}</td>
                <td>{this.dateFormat(this.props.item.applyTime)}</td>
                <td>{this.dateFormat(this.props.item.balanceTime)}</td>
                <td>{this.props.item.status == 1 ? "可结算" : this.props.item.status == 2 ? "待审核" : this.props.item.status == 3 ? "待结算" : this.props.item.status == 4 ? "已结算" : "未通过"}</td>
                <td onClick={this.bombBox.bind(this,this.props.index,this.props.item)}><a href="javascript:;"> {this.statusText(this.props.item.status)}  </a> </td>
            </tr>
        );
    }
}